
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
selection-update
Advanced tools
Computing selection updates on external INPUT value changes, browser style
Computing input selection updates on external file changes, as if we used browser managed undo and redo.
/**
* Calculate the selection update for the given
* current and new input values.
*
* @param {Object} currentSelection as {start, end}
* @param {String} currentValue
* @param {String} newValue
*
* @return {Object} newSelection as {start, end}
*/
calculateUpdate(currentSelection, currentValue, newValue);
var selectionUpdate = require('selection-update');
/**
* Update input with new value.
* @param {Node} $input
* @param {String} newValue
*/
function updateInput($input, newValue) {
var newSelection;
// only retrieve and restore input, if the element
// is currently active
if (document.activeElement === $input) {
// get the current selection and pass it in as {start, end}
newSelection = selectionUpdate(getSelection($input), $input.value, newValue);
}
// apply new value, will naturally send selection to input end
$input.value = value;
if (newSelection) {
// set new {start, end} selection on input
setSelection($input, selection);
}
}
MIT
FAQs
Computing selection updates on external INPUT value changes, browser style
The npm package selection-update receives a total of 19,453 weekly downloads. As such, selection-update popularity was classified as popular.
We found that selection-update demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.